package cz.proks.bank.service;

import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

import cz.cvut.felk.support.aos.sw.testadapter.TestAdapter;
import cz.proks.bank.service.domain.LoanRepaymentRequest;
import cz.proks.bank.service.domain.LoanRequest;
import cz.proks.bank.service.exception.LoanException;

@WebService(targetNamespace = "http://bank.proks.cz/service/ClientService/")
public interface ClientService extends TestAdapter {
	
	@RequestWrapper(className = "cz.proks.bank.service.domain.LoanRequest")
	@ResponseWrapper(className = "cz.proks.bank.service.domain.Loan")
	@WebResult(name = "loanId")
	long requestForLoan(@WebParam(name = "accountNumber") int accountNumber, 
						@WebParam(name = "amount") long amount, 
						@WebParam(name = "currency") String currency) throws LoanException;
	
	@RequestWrapper(className = "cz.proks.bank.service.domain.LoanRepaymentRequest")
	@ResponseWrapper(className = "cz.proks.bank.service.domain.LoanRepayment")
	@WebResult(name = "remainingLoan")
	long insertRepayment(@WebParam(name = "loanId") long loanId, 
						 @WebParam(name = "repaymentAmount") long repaymentAmount, 
						 @WebParam(name = "currency") String currency) throws LoanException;
}
